<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    const ADMIN_PAGE_NUM = 30;

    const RESPONSE_CODE_ERROR = 1;
    const RESPONSE_CODE_SUCCESS = 0;

    /*
     * 返回状态数据
     * @param $code   状态码
     * @param $result 数据
     * @return \Illuminate\Http\JsonResponse
     */
    public function ajaxReturn($code,$result){
        $data = [
            'code' => $code,
            'data' => $result
        ];
        return response()->json($data)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
    }
}
